#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;
class Solution {
public:
    int lower_bound(vector<int>& nums, int target)
    {
        int left = -1, right = nums.size();
        while (left + 1 < right)
        {
            int mid = (right - left) / 2 + left;
            if (nums[mid] >= target)
                right = mid;
            else left = mid;
        }
        return right;
    }
    vector<int> searchRange(vector<int>& nums, int target) {
        int l = lower_bound(nums, target);
        if (l == nums.size() || nums[l] != target)
            return { -1,-1 };
        int r = lower_bound(nums, target + 1) - 1;
        return { l,r };
    }
};